package com.ruge.system.controller;

import com.ruge.common.util.RestResponse;
import com.ruge.system.pojo.entity.SysLogOper;
import com.ruge.system.pojo.request.LogOperRequest;
import com.ruge.system.service.SysLogOperService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author ：爱丽丝、如歌
 * @time ：2020/3/21  12:27
 * 描述 ：
 */
@RestController
@RequestMapping("/loginOper")
@Api(value = "操作日志controller", tags = {"系统操作日志"})
public class SysLogOperController {
    @Resource
    private SysLogOperService sysLogOperService;

    @GetMapping
    @ApiOperation(value = "获取登录日志详细信息", notes = "根据url的id来获取详细信息")
    public RestResponse list(@RequestBody(required = false) LogOperRequest request) {
        return RestResponse.success().setData(sysLogOperService.findAll(request));
    }
    @DeleteMapping("{id}")
    @ApiOperation(value = "删除菜单", notes = "根据url的id来指定删除对象")
    public RestResponse delete(@PathVariable Long id) {
        sysLogOperService.deleteById(id);
        return RestResponse.success();
    }

    @ApiOperation(value = "批量操作", notes = "根据url的id来指定批量操作对象")
    @PostMapping("/batch")
    public RestResponse batch(@RequestBody Map<String, List<SysLogOper>> map) {
        return RestResponse.success().setData(sysLogOperService.batch(map));
    }
}
